strip CR/LF from email header values in mailto notifier#1626
Open
aizu-m wants to merge 1 commit into
Open
Conversation
Member
|
This isn't the correct fix. Incoming jobs should have the job-name attribute validated - aside from catching invalid chars in a name value (the name syntax doesn't allow control chars) we also need to make sure any Unicode/UTF-8 is valid. |
Member
|
OK, so reviewing the current cupsd 2.4.x/2.5 code shows that all of the code paths for job creation and validation make sure that the "job-name" attribute is a single-valued name string with the correct syntax/characters. What version of CUPS are you testing with? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found while reading the notification path, tracing how event attributes end up on the wire.
job-name is an IPP name value chosen by whoever submits the print job. cupsNotifySubject() drops it straight into the subject text:
email_message() then writes that subject into an RFC 5322 header field with CRLF line endings and no sanitising:
So a job submitted with
yields this on the SMTP stream:
The bare CR/LF start new header lines, so the printing user controls extra recipients and injected content in every notification mail. The recipient address and the reply-to value (decoded from notify-user-data) land in the To:/Sender:/Reply-To: headers by the same route.
Conclusion: the header writer must not emit a CR or LF inside a field value. The patch replaces them with spaces in the subject, recipient, and reply-to strings before they reach the cupsFilePrintf header lines. After it the whole job-name stays on the single Subject line.